﻿<?xml version="1.0" encoding="utf-8" ?>
<xs:schema
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  targetNamespace="http://www.codeplex.com/MSSqlSchemaDoc"
  xmlns="http://www.codeplex.com/MSSqlSchemaDoc"
  attributeFormDefault="unqualified"
  elementFormDefault="qualified">

  <xs:include schemaLocation="DataTypeType.xsd" />
  
  <xs:complexType name="ColumnType">
    <xs:sequence>
      
      <xs:element name="DataType" type="DataTypeType" />
      <xs:element name="IsNullable" type="xs:boolean" />
      <xs:element name="HasDefault" minOccurs="0" type="xs:boolean" />
      <xs:element name="DefaultValue" minOccurs="0" type="xs:string" />
      
      <xs:element name="IsIdentity" type="xs:boolean" />
      <xs:element minOccurs="0" name="IdentitySettings">
        <xs:complexType>
          <xs:attribute name="Seed" type="xs:unsignedLong" use="required" />
          <xs:attribute name="Increment" type="xs:unsignedInt" use="required" />
        </xs:complexType>
      </xs:element>
      
      <xs:element name="IsComputed" type="xs:boolean" />
      <xs:element name="ComputationSettings" minOccurs="0">
        <xs:complexType>
          <xs:attribute name="IsPersisted" type="xs:boolean" />
          <xs:attribute name="UsesDatabaseCollation" type="xs:boolean" />
          <xs:attribute name="Definition" type="xs:string" />
        </xs:complexType>
      </xs:element>
      
      <xs:element name="Collation" type="xs:string" />
      <xs:element name="IsAnsiPadded" type="xs:boolean" />
      <xs:element name="IsRowGuid" type="xs:boolean" />
      
      <xs:element name="ColumnKeyConstraint" minOccurs="0">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="KeyConstraintType">
              <xs:simpleType>
                <xs:restriction base="xs:string">
                  <xs:enumeration value="PK"/>
                  <xs:enumeration value="UQ"/>
                </xs:restriction>
              </xs:simpleType>
            </xs:element>
            <xs:element name="IsSystemNamed" type="xs:boolean" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>

      <xs:element name="IndexMembers" minOccurs="0">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="IndexMember" minOccurs="0" maxOccurs="unbounded">
              <xs:complexType>
                <xs:attribute name="Name" type="xs:string" />
                <xs:attribute name="IsIncluded" type="xs:boolean" />
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      
      <xs:element name="IsFullTextIndexed" type="xs:boolean" />

      <xs:element name="ForeignKeyReferences" minOccurs="0">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="ForeignKeyReference" maxOccurs="unbounded">
              <xs:complexType>
                <xs:attribute name="ConstraintName" />
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      
    </xs:sequence>
    <xs:attribute name="Name" type="xs:string" use="required" />
  </xs:complexType>

</xs:schema>
